﻿using PhuLeBooze.UICode;
using PhuLeBussinessObject.News;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PhuLeBooze
{
    public partial class ucNew2Item : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string htmlNews = "";
            string partern = "<li>"
                           + "<img src=\"{0}\" />"
                            + "<h2 class=\"title\"><a href=\"newsdetail/{3}\" newsID=\"{3}\" title=\"{1}\" class=\"newsdetail\">{1}</a></h2>"
                            + "<p>{2}</p>"
                            + "<a href=\"newsdetail.aspx?id={3}\"  newsID=\"{3}\" title=\"{1}\" class=\"readmore newsdetail\">Chi tiết »</a>"
                         + "</li>";
            CNewUI ui = new CNewUI();
            IList<CNews> list = ui.GetTop("TOP2");
            foreach (CNews item in list) {
                htmlNews += string.Format(partern,item.ThumbnailImage,item.Title,item.Summary,item.ID);
                
            }
            ltrDetail.Text = htmlNews;
        }
    }
}